package com.wwj.core.wawa.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wwj.core.wawa.entity.WaWaMachineStatistics;
import com.wwj.core.wawa.entity.mapper.WaWaMachineStatisticsMapper;
import com.wwj.core.wawa.service.IWaWaMachineStatisticsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class WaWaMachineStatisticsServiceImpl implements IWaWaMachineStatisticsService {

    @Resource
    private WaWaMachineStatisticsMapper waWaMachineStatisticsMapper;

    @Override
    public Page<WaWaMachineStatistics> findSingleDayByPage(Map<String, Object> params, int offset, int limit) {
        PageHelper.offsetPage(offset, limit);
        return (Page<WaWaMachineStatistics>)waWaMachineStatisticsMapper.selectWaWaMachineSingleDayStatistics(params);
    }

    @Override
    public Page<WaWaMachineStatistics> findSingleTotalByPage(Map<String, Object> params, int offset, int limit) {
        PageHelper.offsetPage(offset, limit);
        List<WaWaMachineStatistics> list = waWaMachineStatisticsMapper.selectWaWaMachineSingleTotalStatistics(params);
        return (Page<WaWaMachineStatistics>)list;
    }

    @Override
    public Page<WaWaMachineStatistics> findAllDayByPage(Map<String, Object> params, int offset, int limit) {
        PageHelper.offsetPage(offset, limit);
        return (Page<WaWaMachineStatistics>)waWaMachineStatisticsMapper.selectWaWaMachineAllDayStatistics(params);
    }

    @Override
    public Page<WaWaMachineStatistics> findAllTotalByPage(Map<String, Object> params, int offset, int limit) {
        PageHelper.offsetPage(offset, limit);
        return (Page<WaWaMachineStatistics>)waWaMachineStatisticsMapper.selectWaWaMachineAllTotalStatistics(params);
    }

    @Override
    public void updateWaWaMachineStatistics(String statisticsDate) {
        waWaMachineStatisticsMapper.updateWaWaMachineStatistics(statisticsDate);
    }
}
